const { gql, ApolloServer } = require('apollo-server')
//定义schema
const Types = gql`
    type Book{
        name:String,
        price:Float
    }
    type Query{
        books:[Book]
    }
`
const books = [{
    name: 'a', price: 10.20
}]
const resolver = {
    Query: {
        books() {
            return books
        }
    }
}
const app = new ApolloServer({typeDefs:Types, resolvers:resolver})
app.listen().then(
    () => {
        console.log('app is ruuning')
    }
)